// import http from "@/utils/http";
import https from "@/utils/https";
// 加入购物车
export const insertCartAPI = ({ skuId, count }) => {
  return https({
    url: "/member/cart",
    method: "POST",
    data: {
      skuId,
      count,
    },
  });
};
export const getCartAPI = () => {
  return https({
    url: "/member/cart",
  });
};
// 删除购物车
export const delCartAPI = (ids) => {
  return https({
    url: "/member/cart",
    method: "DELETE",
    data: {
      ids,
    },
  });
};
//合并
export const mergeCartAPI = (data) => {
  return https({
    url: "/member/cart/merge",
    method: "POST",
    data,
  });
};

export const changeStatusAPI = (skuId,selected) => {
  return https({
    url: "/member/cart/status",
    method: "PUT",
    params: { skuId, selected },
  });
};
export const changeStatusAllAPI = (selected) => {
  return https({
    url: "/member/cart/status/all",
    method: "PUT",
    params: {selected },
  });
};

export const updateCartAPI = (skuId,count) => {
  return https({
    url: "/member/cart/update",
    method: "PUT",
    params: { skuId, count },
  });
};